<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@page import="com.sun.xml.internal.fastinfoset.Encoder"%>
<%@ taglib prefix="s" uri="/struts-tags"%> 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<html>
<head>
<title>北京</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<script language="javascript" src="/js/common/jquery-1.4.2.min.js"></script> 	
<link href="/usercenter/css/usercenter.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="/usercenter/js/usercenter.js"></script>
<script language="javascript" src="/js/calendar.js"></script>
<script language="javascript" src="/usercenter/js/quotationcontrol.js"></script>
<script language="javascript" src="/usercenter/js/tipswindown.js"></script>
<script language="javascript">
var cdr = new Calendar("cdr");
document.write(cdr);
cdr.showMoreDay = true; 		
var i = 0;
</script>
</head>

<body>
<div class="main">
	<div class="maintable">
		<form id="sform" name="sform"  method="post" action="">
		<table class="tb" border="1" bordercolor="#e7e7e7" >	
		  	<tr>
			  	<td colspan="4" class="maintitle" >
					<div class="maintitleimg"></div>
					<div class="maintitle_a">报价单</div>
			  	</td>
      	  	</tr>
	    	<tr>
		    	<td width="15%" align="right" class="field" >供应商名称：</td>
				<td width="35%" align="left" class="fieldtext" >${ssup.supplierName }
					<input type="hidden" name="model.supplierid" value="${ssup.supplierid }" />
					<input type="hidden" name="model.quotationid" value="${model.quotationid }" />
				</td>
		    	<td width="15%" align="right" class="field" >生单日期：</td>
				<td width="35%" align="left" class="fieldtext" >${model.def9 }
					<input type="hidden" name="model.def9" value="${model.def9 }" />
				</td>
		  	</tr>	
	    	<tr>
		    	<td align="right" class="field" ><span class="comment" >*</span>报价日期：</td>
				<td align="left" class="fieldtext" >
					<div class="text_control">
						<input type="text" id="quotationTime" name="model.quotationTime" value="${model.quotationTime }" onClick="cdr.show(this);" readonly="readonly" />
					</div>
				</td>
		    	<td align="right" class="field" ><span class="comment" >*</span>报价失效日期：</td>
				<td align="left" class="fieldtext" >
					<div class="text_control">
						<input type="text" id="endTime" name="model.endTime" value="${model.endTime }" onClick="cdr.show(this);" readonly="readonly" />
					</div>
				</td>
			</tr> 	
	    	<tr>
		    	<td align="right" class="field" ><span class="comment" >*</span>付款方式：</td>
				<td align="left" class="fieldradio" >
					<div class="text_control">
						<input type="radio" name="model.payType" value="0" checked="checked" onclick="javascript:$('.yj').hide();$('.yfk').show();"/>预付款
						<input type="radio" name="model.payType" value="1" onclick="javascript:$('.yfk').hide();$('.yj').show();"/>月结
					</div>
				</td>			
		    	<td align="right" class="field" ><span class="yfk">预付款(%)：</span><span class="yj" style="display:none">月结(天)：</span></td>
				<td align="left" class="fieldtext">
					<input type="text" class="yfk" id="imprest" name="model.imprest" value="${model.imprest }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="3" />
					<input type="text" class="yj" id="settlement" name="model.settlement" value="${model.settlement }" style="display:none;" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="3" />
				</td>		
		  	</tr>		
	    	<tr>
		    	<td align="right" class="field" >币种：</td>
				<td align="left" class="fieldtext">
					<select id="currency" name="model.currency" >
						<option value="人民币" <s:if test="model.currency == '人民币'">selected="selected"</s:if>>人民币</option>
						<option value="美元" <s:if test="model.currency == '美元'">selected="selected"</s:if>>美元</option>
						<option value="欧元" <s:if test="model.currency == '欧元'">selected="selected"</s:if>>欧元</option>
						<option value="日元" <s:if test="model.currency == '日元'">selected="selected"</s:if>>日元</option>
					</select>
				</td>	
		    	<td align="right" class="field" >运输方式：</td>
				<td align="left" class="fieldradio">
					<input type="radio" name="model.transportType" value="陆运" <s:if test="model.transportType == '陆运'">checked="checked"</s:if> />陆运
					<input type="radio" name="model.transportType" value="空运" <s:if test="model.transportType == '空运'">checked="checked"</s:if> />空运
					<input type="radio" name="model.transportType" value="海运" <s:if test="model.transportType == '海运'">checked="checked"</s:if> />海运
					<input type="radio" name="model.transportType" value="混合运输" <s:if test="model.transportType == '混合运输'">checked="checked"</s:if> />混合运输
				</td>				
		  	</tr>	 	
	    	<tr>
		    	<td align="right" class="field" ><span class="comment" >*</span>供应周期(天)：</td>
				<td align="left" class="fieldtext"><div class="text_control"><input type="text" id="supplyCycle" name="model.supplyCycle" value="${model.supplyCycle }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="3" /></div></td>	
		    	<td align="right" class="field" ><span class="comment" >*</span>税率(%)：</td>
				<td align="left" class="fieldtext"><div class="text_control"><input type="text" id="taxRate" name="model.taxRate" value="${model.taxRate }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="3" /></div></td>				
		  	</tr>	 	
	    	<tr>
		    	<td align="right" class="field" >商品规格：</td>
				<td align="left" class="fieldtext" colspan="3"><textarea id="cargoStandard" name="model.cargoStandard" cols="50%" rows="6">${model.cargoStandard }</textarea></td>
			</tr>		
		  	<tr>
		    	<td align="right" class="field" >产品报价：</td>
				<td align="left" class="fieldradio" colspan="3">
					<table class="tableStyle" id="aaa" width="90%" cellspacing="1">
			  			<tr>
						    <th align="center">商品名称</th>
						    <th align="center">单价</th>
						    <th align="center">单位</th>
						    <th align="center">起订数量</th>
						    <th align="center">操作</th>
					  	</tr>
			  			<s:if test="action == 'view'" >
					  	<s:iterator value="modelbody" id="bodyval" status="squostatus">
				 	 	<tr id="tr${squostatus.index }">
						    <td align="center" bgcolor="#ffffff">
						    	<input type="hidden" name="modelbody[${squostatus.index }].quocargoid" value="${bodyval.quocargoid }"  />
						    	<input class="referName" style="width:100px;" name="modelbody[${squostatus.index }].name" value="${bodyval.name }" onfocus="return gotoEdit1('选择商品', 1, ${squostatus.index });"/>
						    </td>
						    <td align="center" bgcolor="#ffffff"><input class="referPrice" style="width:150px;" name="modelbody[${squostatus.index }].price" value="${bodyval.price }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="8"/></td>
						    <td align="center" bgcolor="#ffffff"><input style="width:100px;" name="modelbody[${squostatus.index }].unit" value="${bodyval.unit }" /></td>
				    		<td align="center" bgcolor="#ffffff"><input class="referLeast" style="width:50px;" name="modelbody[${squostatus.index }].least" value="${bodyval.least }" onkeyup="this.value=this.value.replace(/\D/g,'')" onafterpaste="this.value=this.value.replace(/\D/g,'')" maxlength="8"/></td>
				    		<td align="center" bgcolor="#ffffff"><a href="#" onclick="return deleteItem(${squostatus.index }, ${bodyval.quocargoid});">删除</a></td>
			  			</tr>
			    		<script type="text/javascript">
			    			i++;
			    		</script>
			  			</s:iterator>
			  			</s:if>
					</table>
				</td>				
		  	</tr>	
		  	<tr>
			  	<td align="center" colspan="4" class="maintitle" >
			  		<input type="button" id="squobutton" value="保存" onclick="javascritp:$('form#sform').attr('action','/usercenter/quotation_insert_Quotation.do?action=save');$('form#sform').submit();"/>
			  		<s:if test="model.status == 0"><input type="button" value="提交" onclick="javascritp:$('form#sform').attr('action','/usercenter/quotation_insert_Quotation.do?action=submit');$('form#sform').submit();"/></s:if>
			  		<input type="reset" value="重置" onclick="return resetConfirm();" />
			  		<input type="button" class="insertrow" value="添加一行" />
			  		<input type="button" value="返回" onclick="back();" />
  					<input type="text" id="deleteId" name="deleteId" value="" />
			  	</td>
      	  	</tr>
        </table>
        </form>
	</div>
</div>
<script type="text/javascript">
function deleteItem(index, id) {
	if(confirm("请问您确定删除么?")) {
		$("#tr"+index).remove();
		var c = $("#deleteId").val();
		if(id >= 0)
			if(c == "")
				$("#deleteId").val(id);
			else
				$("#deleteId").val(c + "," + id);
	}
	return false;
}
$().ready(function() {
	$(".insertrow").click(function() {			
	if(i<20){
		var val="<tr id='tr"+i+"'>";
		val+="<td align=\"center\" bgcolor=\"#ffffff\"><input class=\"referName\" style='width:100px;' name='modelbody["+i+"].name' value='' onfocus=\"return gotoEdit1('选择商品', 1, "+i+");\"/></td>";
		val+="<td align=\"center\" bgcolor=\"#ffffff\"><input class=\"referPrice\" style='width:150px;' name='modelbody["+i+"].price' value=''  onkeyup=\"this.value=this.value.replace(/\D/g,'')\" onafterpaste=\"this.value=this.value.replace(/\D/g,'')\" maxlength=\"8\"/></td>";
		val+="<td align=\"center\" bgcolor=\"#ffffff\"><input style='width:100px;' name='modelbody["+i+"].unit' value=''  /></td>";
		val+="<td align=\"center\" bgcolor=\"#ffffff\"><input class=\"referLeast\" style='width:50px;' name='modelbody["+i+"].least' value=''  onkeyup=\"this.value=this.value.replace(/\D/g,'')\" onafterpaste=\"this.value=this.value.replace(/\D/g,'')\" maxlength=\"8\"/></td>";
		val+="<td align=\"center\" bgcolor=\"#ffffff\"><a href=\"#\" onclick=\"return deleteItem("+i+", -1);\">删除</a></td>";
		val+="</tr>";
		$("table.tableStyle").append(val);
		i++;
		}
	});
}); 	
</script>
</body>
</html>